package com.example.mapper;

import com.example.entity.Login;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 陈昌吉
 * @since 2024-04-16
 */
@Mapper
public interface LoginMapper extends BaseMapper<Login> {

    @Select("select * from login where sno=#{sno} and password=#{password}")
    Login getUser(Login login);

    @Select("select * from login ")
    List<Login> selectLogin();

    @Insert("insert into login (sno,name,birthdate,sclass,position) values (#{sno},#{name},#{birthdate},#{sclass},#{position})")
    void add(Login login);

    Page<Login> seleectgetLogin(Login login);

    @Select("select role from login where id=#{currentId}")
    Login selectByID(Integer currentId);

    @Select("select * from login where name= #{name} ")
    List<Login> searchs(String name);

}
